#ifndef RANDOM_TEST_H
#define RANDOM_TEST_H

#include "include/gtest.h"
#include "../Tool/include/Random.h"
#include "../Tool/include/Timer.h"
#include "../Tool/include/ILogger.h"
using namespace Tool;

TEST(Random, Randomrandom)
{
    Random random;
    for(int i = 0; i < 10; ++i)
    {
        LOG_INFO("随机整数：%d", random.GetInt(10,100));
        LOG_INFO("随机浮点数：%f", random.GetDouble(10,100));
        LOG_INFO("随机bool数：%d", random.GetBool());
    }
    std::vector<std::string> words = { "Hellow", "Word", "you", "are", "Good"};
    std::string word = random.Choose<std::vector<std::string>>(words); //随机选择
    LOG_INFO("Chooes one:%s", word.c_str());
    for(auto &word : words)
    {
        LOG_INFO("%s ", word.c_str());
    }
    random.Shuffle<std::vector<std::string>>(words);        //打乱数据
    LOG_INFO("");
    for(auto &word : words)
    {
        LOG_INFO("%s ", word.c_str());
    }
}

TEST(Timer, Timertimer)
{
    //计时器
    Timer timer;
    LOG_INFO("hellow word");
    std::string name = "10毫秒";
    LOG_INFO("耗时：%fms", timer.Elapsed());
    LOG_INFO("耗时：%fns", timer.ElapsedNanoseconds());
    LOG_INFO("耗时：%s", name.c_str());
}

#endif // RANDOM_TEST_H
